n, m, k = map(int, input().split())
up_down = [list(map(int, input().split())) for _ in range(n)]
poles = dict()
for _ in range(k):
    p, l, h = map(int, input().split())
    poles[p] = (l, h)
dp = [dict() for _ in range(n)]
# 0 位置所有值均为0 1 位置 除杆位置所有也为0
if 1 in poles:
    for h in range(poles[1][0] + 1, poles[1][1]):
        dp[1][h] = 0
